<template>
    <div class="app-container">
      <div class="block">
        <el-row  :gutter="24">

          <el-col :span="6">
            <el-input v-model="listQuery.code" placeholder="工单号"></el-input>
          </el-col>
          <el-col :span="4">
            <el-input v-model="listQuery.applyMobile" placeholder="联系电话"></el-input>
          </el-col>
          <el-col :span="4">
            <el-select v-model="listQuery.state" placeholder="选择处理状态">
              <el-option
                v-for="item in options.repairState"
                :key="item.k"
                :label="item.v"
                :value="item.k">
              </el-option>
            </el-select>
          </el-col>
          <el-col :span="4">
            <el-select v-model="listQuery.feeState" placeholder="选择缴费状态">
              <el-option
                v-for="item in options.feeState"
                :key="item.k"
                :label="item.v"
                :value="item.k">
              </el-option>
            </el-select>
          </el-col>
          <el-col :span="6">
            <el-button type="success" icon="el-icon-search" @click.native="search">{{ $t('button.search') }}</el-button>
            <el-button type="primary" icon="el-icon-refresh" @click.native="reset">{{ $t('button.reset') }}</el-button>
          </el-col>
        </el-row>
        <br>
      </div>
        <!--<div class="block">
            <el-row>
                <el-col :span="24">
                    <el-button type="success" icon="el-icon-plus" @click.native="add">{{ $t('button.add') }}</el-button>
                    <el-button type="primary" icon="el-icon-edit" @click.native="edit">{{ $t('button.edit') }}</el-button>
                    <el-button type="danger" icon="el-icon-delete" @click.native="remove">{{ $t('button.delete') }}</el-button>
                </el-col>
            </el-row>
        </div>-->


        <el-table :data="list" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row>
          <el-table-column type="expand">
            <template slot-scope="props">
              <el-form label-position="right" inline class="guns-table-expand">
                <el-form-item label="工单号" >
                  <span>{{ props.row.code }}</span>
                </el-form-item>
                <el-form-item label="" >
                </el-form-item>
                <el-form-item label="房屋编号" >
                  <span>{{ props.row.house }}</span>
                </el-form-item>
                <el-form-item label="报修时间" >
                  <span>{{ props.row.createTime }}</span>
                </el-form-item>
                <el-form-item label="报修类型" >
                  <span>{{ props.row.applyTypeName }}</span>
                </el-form-item>
                <el-form-item label="报修客户" >
                  <span>{{ props.row.custName }}</span>
                </el-form-item>
                <el-form-item label="联系人" >
                  <span>{{ props.row.applyName }}</span>
                </el-form-item>
                <el-form-item label="联系电话" >
                  <span>{{ props.row.applyMobile }}</span>
                </el-form-item>
                <el-form-item label="报修描述" >
                  <span>{{ props.row.applyContent }}</span>
                </el-form-item>
                <el-form-item label="报修附件" >
                  <el-button v-if="props.row.payId>0" type="text" @click.native="viewApplyPics(props.row.id)">查看记录</el-button>
                </el-form-item>
                <el-form-item label="处理状态" >
                  <span style="color:blue;" v-if="props.row.state===9">{{props.row.stateName}}</span>
                  <span style="color:red;" v-if="props.row.state!=9">{{props.row.stateName}}</span>
                </el-form-item>
                <el-form-item label="">
                </el-form-item>
                <el-form-item label="处理人" >
                  <span>{{ props.row.userName }}</span>
                </el-form-item>
                <el-form-item label="处理人电话" >
                  <span>{{ props.row.userMobile }}</span>
                </el-form-item>
                <el-form-item label="处理人反馈" >
                  <span>{{ props.row.executeContent }}</span>
                </el-form-item>
                <el-form-item label="反馈附件">

                </el-form-item>
                <el-form-item label="产生费用" >
                  <span v-if="props.row.feeAmt > 0">{{props.row.feeAmt}} 元</span>
                  <span v-if="!props.row.feeAmt"> 未确定 </span>
                </el-form-item>
                <el-form-item label="费用状态" >
                  <span style="color:blue;" v-if="props.row.feeState===1 || props.row.feeState===3">{{props.row.feeStateName}}</span>
                  <span style="color:red;" v-if="props.row.feeState===2 || props.row.feeState===4">{{props.row.feeStateName}}</span>
                </el-form-item>

                <el-form-item label="缴费时间">
                  <span>{{ props.row.payTime }}</span>
                </el-form-item>
                <el-form-item label="缴费记录">
                  <el-button v-if="props.row.payId>0" type="text" @click.native="viewPayInfo(props.row.payId)">查看记录</el-button>
                </el-form-item>
                <el-form-item label="评分">
                  <span>{{ props.row.ev }}</span>
                </el-form-item>
                <el-form-item label="评价">
                  <span>{{ props.row.em }}</span>
                </el-form-item>
              </el-form>
            </template>
          </el-table-column>

          <el-table-column label="工单号" prop="code" width="200" align="center"></el-table-column>
          <el-table-column label="房屋编号" prop="house" width="120" align="center"></el-table-column>
          <el-table-column label="报修时间" prop="createTime" width="160" align="center"></el-table-column>
          <el-table-column label="报修类型" prop="applyTypeName" align="center"></el-table-column>
          <el-table-column label="联系人" prop="applyName" align="center"></el-table-column>
          <el-table-column label="联系电话" prop="applyMobile" width="120" align="center"></el-table-column>
          <el-table-column label="处理状态" prop="stateName" align="center">
            <template slot-scope="scope">
              <span style="color:blue;" v-if="scope.row.state===9">{{scope.row.stateName}}</span>
              <span style="color:red;" v-if="scope.row.state!=9">{{scope.row.stateName}}</span>
            </template>
          </el-table-column>
          <el-table-column label="产生费用" prop="feeAmt" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.feeAmt > 0">{{scope.row.feeAmt}} 元</span>
              <span v-if="!scope.row.feeAmt"> 未确定 </span>
            </template>
          </el-table-column>
          <el-table-column label="费用状态" prop="feeStateName" align="center">
            <template slot-scope="scope">
              <span style="color:blue;" v-if="scope.row.feeState===1 || scope.row.feeState===3">{{scope.row.feeStateName}}</span>
              <span style="color:red;" v-if="scope.row.feeState===2 || scope.row.feeState===4">{{scope.row.feeStateName}}</span>
            </template>
          </el-table-column>

        </el-table>

        <el-pagination
                background
                layout="total, sizes, prev, pager, next, jumper"
                :page-sizes="[10, 20, 50, 100,500]"
                :page-size="listQuery.limit"
                :total="total"
                @size-change="changeSize"
                @current-change="fetchPage"
                @prev-click="fetchPrev"
                @next-click="fetchNext">
        </el-pagination>

        <el-dialog
                :title="formTitle"
                :visible.sync="formVisible"
                width="70%">
            <el-form ref="form" :model="form" :rules="rules" label-width="150px">
                <el-row>
                  显示缴费记录: payId={{payId}}
                </el-row>
                <el-form-item>
                    <el-button @click.native="formVisible = false">{{ $t('button.close') }}</el-button>
                </el-form-item>

            </el-form>
        </el-dialog>

        <el-dialog
          :title="imgTitle1"
          :visible.sync="imgVisible1"
          width="70%">
          <template>
            <div class="content">
              <viewer :images="applyImages">
                <img v-for="src in applyImages" :src="src.url" :key="src.title" width="100%">
              </viewer>
            </div>
          </template>
        </el-dialog>
    </div>
</template>

<script src="./repair_info.js"></script>


<style rel="stylesheet/scss" lang="scss" scoped>
    @import "src/styles/common.scss";

    .table-simple-checkbox{
      .el-checkbox__label{
        display: none;
      }
    }
</style>

